<?php

namespace App\Http\Controllers;

use App\Services\TradeCateService;
use App\Services\TradeService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class TradeController extends Controller
{
    /**
     * 分类列表
     * @param Request $request
     * @return JsonResponse
     */
    public function cateList()
    {
        $data = TradeCateService::getInstance()->list();
        return $this->success($data);
    }

    /**
     * 商务列表
     * @param Request $request
     * @return JsonResponse
     */
    public function list(Request $request)
    {
        $cateId = $request->input('cate_id', 0);
        $data = TradeService::getInstance()->list($cateId);
        return $this->success($data);
    }

    /**
     * 商务详情
     * @param Request $request
     * @return JsonResponse
     */
    public function detail(Request $request)
    {
        $tradeId = $request->input('trade_id', 0);
        $data = TradeService::getInstance()->detail($tradeId);
        return $this->success($data);
    }
}
